<script type="text/javascript">
 function checkLogin()
 {
     alert('您还没有登陆');
     return false;
 }
  function checknon()
 {
     alert('该教师暂无视频');
     return false;
 }
</script>
<div id="indexcates">
        <?php
                global $db;
                $sql = "select * from nettteach_department where 1 = 1";
                $result_department = $db -> query($sql);
                while($row_department=$db->fetch_array($result_department)){

        ?>
        <div class="span9"><!--老师排行榜开始-->
        <div class="row-fluid" style="margin-top:10px;">
            <ul class="breadcrumb">
                <li><?php echo ($row_department['name'])?> </li>
            </ul>
        </div>			
        <div id="01">
            <div class="row-fluid">
        <?php
                $sql = "select * from nettteach_member where type in( '2','1') and departmentid = '".$row_department['id']."' ";
                $result = $db -> query($sql);
                while($row=$db->fetch_array($result)){
                        $sql_videos = "select * from nettteach_videos where belonger = '".$row['id']."' and state ='0' order by intotime desc ";
                        $result_videos = $db -> query($sql_videos);
                        if($row_videos=$db->fetch_array($result_videos)){
        ?>
                <div class="span4" align="center">
                    <h3><a href="?do=videolist&teacher_id=<?php echo($row['id'])?>" <?php if($_SESSION['sid']==''){ ?> onclick="return checkLogin()" <?php }?>><?php echo($row['realname']);?> 老师</a></h3> 
                        最后视频：<?php echo(sub_str($row_videos['title'],10))?>  			  <p>更新时间：<?php echo(date('Y-m-d',$row_videos['intotime']))?>			  </p>
                        <p><a class="btn btn-info" href="?do=videolist&teacher_id=<?php echo($row['id'])?>" <?php if($_SESSION['sid']==''){ ?> onclick="return checkLogin()" <?php }?> >进入 »</a></p>
                </div><!--/span-->
                <?php 
                        }else
                        {
                ?>
                <div class="span4" align="center">
                    <h3><a href="" <?php if($_SESSION['sid']==''){ ?> onclick="return checkLogin()" <?php }?>><?php echo($row['realname']);?> 老师</a></h3> 
                        最后视频:暂无 			  <p>更新时间：暂无			  </p>
                        <p><a class="btn btn-info" href="#" onclick="return checknon()" >进入 »</a></p>
                </div>
                <?php
                        }
                }?>
            </div><!--/row-->
        </div>
        
        
    </div>
        <?php }?>
</div>
